<template>
  <div>
    名称
    <van-field v-model='form.name'/>
    选择分类<select v-model='form.cid'>
    <option v-for='i in catelist' :value='i.id'>{{ i.name }}</option>
  </select>
    <van-button @click='add'>添加</van-button>

  </div>
</template>
<script>
export default {
  data() {
    return {
      form: {},
      catelist: [],
    }
  },
  methods: {
    getcatelist() {
      this.axios.get('cateM').then(res => {
        this.catelist = res.data.list
        this.form.cid = res.data.list[0]['id']
      })
    },
    add() {
      this.axios.post('goodsM', this.form).then(res => {

      })
    },

  },
  mounted() {
    this.getcatelist()
  },
}
</script>
<style>

</style>